package org.xxpay.pay.channel.ywxpay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * @author: dingzhiwei
 * @date: 19/1/22
 * @description: 云微信支付
 */
@Component
public class YwxpayConfig {

    public static final String CHANNEL_NAME = "ywxpay";
    public static final String CHANNEL_NAME_QR = CHANNEL_NAME + "_qr";

    public static final String RETURN_VALUE_SUCCESS = "success";
    public static final String RETURN_VALUE_FAIL = "fail";
    public static final String WX_NOTIFY_QUEUE_NAME = "queue.wx.event.notify";

    public static final String KEY = "OLt6gOhtsaVXRG44P1FFzdWrBRYcRh6FzFKMOlnI";

    private String serverId;        // 服务器ID
    private String reqUrl;          // 接口地址
    private Long dayMaxAmount;      // 日收款最大金额(单位分)
    private Long dayMaxNumber;      // 日收款最大单数


    public YwxpayConfig(){}

    public YwxpayConfig(String payParam) {
        Assert.notNull(payParam, "init ywxpay config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.serverId = object.getString("serverId");
        this.reqUrl = object.getString("reqUrl");
        this.dayMaxAmount = object.getLong("dayMaxAmount");
        this.dayMaxNumber = object.getLong("dayMaxNumber");

    }

    public String getServerId() {
        return serverId;
    }

    public void setServerId(String serverId) {
        this.serverId = serverId;
    }

    public String getReqUrl() {
        return reqUrl;
    }

    public void setReqUrl(String reqUrl) {
        this.reqUrl = reqUrl;
    }

    public Long getDayMaxAmount() {
        return dayMaxAmount;
    }

    public void setDayMaxAmount(Long dayMaxAmount) {
        this.dayMaxAmount = dayMaxAmount;
    }

    public Long getDayMaxNumber() {
        return dayMaxNumber;
    }

    public void setDayMaxNumber(Long dayMaxNumber) {
        this.dayMaxNumber = dayMaxNumber;
    }
}
